public class ThreadTwo implements Runnable {//ʵֽӿ
    private String name;//˽гԱ
    public ThreadTwo(String name) {
    	this.name=name;
    }
    public void run(){//д
    	for(int i=0;i<10;i++){
    	    System.out.println("My name is: "+name);
    	    try{
    	        Thread.sleep(500);//ͣ߳0.5
    	    }catch(InterruptedException e){
    	    	e.printStackTrace();
    	    }
    	}		    
    }
    public static void main(String[] args) {
        ThreadTwo r1=new ThreadTwo("Tom");//run()Ķ
        ThreadTwo r2=new ThreadTwo("Peter");
        Thread t1=new Thread(r1);//߳
        Thread t2=new Thread(r2);
        t1.start();//߳
        t2.start();   
    }
}
